package com.team.ai.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.stp.StpUtil;
import com.team.ai.service.RecordingService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

@CrossOrigin//跨域
@RestController//遵循RestFul
@RequestMapping("v2/Recording/")
public class RecordingController {
    @Resource
    RecordingService recordingService;
    @SaCheckLogin
    @PostMapping("insert")
    public String insert(
            @RequestParam(value = "svId",defaultValue = "-1") int svId,
            @RequestParam(value = "title",defaultValue = "-1") String title,
            @RequestParam(value = "video",defaultValue = "-1") String video
    ){
        int userId = StpUtil.getLoginIdAsInt();
        return recordingService.insert(userId, svId,title,video);
    }
    @SaCheckLogin
    @GetMapping("selectList")
    public String selectList(

    ){
        int userId = StpUtil.getLoginIdAsInt();
        return  recordingService.selectList(userId);
    }
}
